package qita;

import java.util.*;

public class main1 {
    public static void main(String[] args) {
        List<NumberPair> pairs = new ArrayList<>();
        for (int i = 0; i < 100; i++) {
            double randomValue = Math.random();
            pairs.add(new NumberPair(i, randomValue));
        }

        Collections.sort(pairs, new Comparator<NumberPair>() {
            @Override
            public int compare(NumberPair o1, NumberPair o2) {
                return Double.compare(o1.randomValue, o2.randomValue);
            }
        });

        for (NumberPair pair : pairs) {
            System.out.print(pair.number + " ");
        }
    }

    static class NumberPair {
        int number;
        double randomValue;

        NumberPair(int number, double randomValue) {
            this.number = number;
            this.randomValue = randomValue;
        }
    }
}
